<template>
  <NCascader v-bind="attrs" :options="props.dictData">
    <template v-for="(_, name) in slots" #[name]="slotData">
      <slot :name="name" v-bind="slotData || {}" />
    </template>
  </NCascader>
</template>

<script lang="ts" setup>
import type { CascaderProps } from 'naive-ui'
import type { NvOption } from '@/types'
import { NCascader } from 'naive-ui'
import { useAttrs } from 'vue'

defineOptions({
  inheritAttrs: false,
})

// fix: attrs 属性不能被侦听器使用，会导致监听整个对象
const props = defineProps<{ dictData?: NvOption[] }>()
const slots = defineSlots()
const attrs = useAttrs() as CascaderProps
</script>
